package com.ymttest.database.model.mongo.query;


import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Field;

import com.ymttest.database.model.annotation.Column;
import com.ymttest.database.model.annotation.Table;
import com.ymttest.database.mongo.config.SellerIndexField;

/**
 * Created by zhangyifan on 2016/12/8.
 */
public class SellerIndex {

    /**
     * 订单ID
     */
    @Table("Ymt_Orders")
    @Column("iOrderId")
    @Id
    private Long id;

    /**
     * 插入时间
     */
    @Field(SellerIndexField.TIME_MONGO_ADD)
    private Date timeMongoAdd;

    /**
     * 更新时间
     */
    @Field(SellerIndexField.TIME_MONGO_UPDATE)
    private Date timeMongoUpdate;


    /**
     * 主单ID
     */
    @Table("Ymt_Orders")
    @Column("iMainOrderId")
    @Field(SellerIndexField.MAIN_ORDER_ID)
    private Long mainOrderId;

    /**
     * 买家ID
     */
    @Table("Ymt_Orders")
    @Column("iUserId")
    @Field(SellerIndexField.USER_ID)
    private Long userId;

    /**
     * 卖家ID
     */
    @Table("Ymt_Orders")
    @Column("iBuyerid")
    @Field(SellerIndexField.SELLER_ID)
    private Long sellerId;

    /**
     * 订单状态
     */
    @Table("Ymt_Orders")
    @Column("iTradingStatus")
    @Field(SellerIndexField.STATUS)
    private Integer tradingStatus;

    /**
     * 下单时间
     */
    @Table("Ymt_Orders")
    @Column("dAddTime")
    @Field(SellerIndexField.ADD_TIME)
    private Date addTime;

    /**
     * 付款时间
     */
    @Table("Ymt_Orders")
    @Column("dPaidTime")
    @Field(SellerIndexField.PAID_TIME)
    private Date paidTime;

    /**
     * 接单时间
     */
    @Table("Ymt_Orders")
    @Column("dAcceptTime")
    @Field(SellerIndexField.ACCEPT_TIME)
    private Date acceptTime;

    /**
     * 发货时间
     */
    @Table("Ymt_Orders")
    @Column("dDispathTime")
    @Field(SellerIndexField.DELIVERY_TIME)
    private Date deliveryTime;


    /**
     * 国内配送
     */
    @Table("Ymt_Orders")
    @Column("bDomesticDelivered")
    @Field(SellerIndexField.LOCAL_DELIVERY)
    private boolean localDelivery;

    /**
     * 预售
     */
    @Table("Ymt_Orders")
    @Column("bPreSale")
    @Field(SellerIndexField.PRE_SALE)
    private boolean preSale;

    /**
     * 旗子
     */
    @Table("Ymt_O_OrderNote")
    @Column("iRemarkLevel")
    @Field(SellerIndexField.REMARK_LEVEL)
    private Integer remarkLevel;

    /**
     * 应收
     */
    @Table("Ymt_Orders")
    @Column("fPayableAmount")
    @Field(SellerIndexField.USER_PAY)
    private BigDecimal userPay;

    /**
     * 成交额(TotalPrice + Freight)
     */
    @Table("Ymt_Orders")
    @Field(SellerIndexField.SALES)
    private BigDecimal sales;

    /**
     * 平台优惠券
     */
    @Table("Ymt_Orders")
    @Column("fYmtCouponAmount")
    @Field(SellerIndexField.YMT_COUPON_AMOUNT)
    private BigDecimal ymtCouponAmount;

    /**
     * 物流类型
     */
    @Table("Ymt_OrderInfo")
    @Column("iCatalogStatus")
    @Field(SellerIndexField.DELIVERY_TYPE)
    private Integer deliveryType;

    /**
     * 买家登录Id
     */
    @Table("Ymt_Orders")
    @Column("sBuyerLoginId")
    @Field(SellerIndexField.USER_LOGIN)
    private String userLogin;

    /**
     * 收货人
     */
    @Table("Ymt_Orders")
    @Column("sReceivePerson")
    @Field(SellerIndexField.RECEIVER)
    private String receiver;

    /**
     * 物流单号
     */
    @Table("Ymt_BillCodeSummary")
    @Column("BillCode")
    @Field(SellerIndexField.BILL_CODE)
    private List<String> billCode;

    /**
     * 是否退款
     */
    @Table("Ymt_RefundBill")
    @Field(SellerIndexField.REFUNDED)
    private boolean refunded;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getTimeMongoAdd() {
        return timeMongoAdd;
    }

    public void setTimeMongoAdd(Date timeMongoAdd) {
        this.timeMongoAdd = timeMongoAdd;
    }

    public Date getTimeMongoUpdate() {
        return timeMongoUpdate;
    }

    public void setTimeMongoUpdate(Date timeMongoUpdate) {
        this.timeMongoUpdate = timeMongoUpdate;
    }

    public Long getMainOrderId() {
        return mainOrderId;
    }

    public void setMainOrderId(Long mainOrderId) {
        this.mainOrderId = mainOrderId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getSellerId() {
        return sellerId;
    }

    public void setSellerId(Long sellerId) {
        this.sellerId = sellerId;
    }

    public Integer getTradingStatus() {
        return tradingStatus;
    }

    public void setTradingStatus(Integer tradingStatus) {
        this.tradingStatus = tradingStatus;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public Date getPaidTime() {
        return paidTime;
    }

    public void setPaidTime(Date paidTime) {
        this.paidTime = paidTime;
    }

    public Date getAcceptTime() {
        return acceptTime;
    }

    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime;
    }

    public Date getDeliveryTime() {
        return deliveryTime;
    }

    public void setDeliveryTime(Date deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    public boolean isLocalDelivery() {
        return localDelivery;
    }

    public void setLocalDelivery(boolean localDelivery) {
        this.localDelivery = localDelivery;
    }

    public boolean isPreSale() {
        return preSale;
    }

    public void setPreSale(boolean preSale) {
        this.preSale = preSale;
    }

    public Integer getRemarkLevel() {
        return remarkLevel;
    }

    public void setRemarkLevel(Integer remarkLevel) {
        this.remarkLevel = remarkLevel;
    }

    public BigDecimal getUserPay() {
        return userPay;
    }

    public void setUserPay(BigDecimal userPay) {
        this.userPay = userPay;
    }

    public BigDecimal getSales() {
        return sales;
    }

    public void setSales(BigDecimal sales) {
        this.sales = sales;
    }

    public BigDecimal getYmtCouponAmount() {
        return ymtCouponAmount;
    }

    public void setYmtCouponAmount(BigDecimal ymtCouponAmount) {
        this.ymtCouponAmount = ymtCouponAmount;
    }

    public Integer getDeliveryType() {
        return deliveryType;
    }

    public void setDeliveryType(Integer deliveryType) {
        this.deliveryType = deliveryType;
    }

    public String getUserLogin() {
        return userLogin;
    }

    public void setUserLogin(String userLogin) {
        this.userLogin = userLogin;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public List<String> getBillCode() {
        return billCode;
    }

    public void setBillCode(List<String> billCode) {
        this.billCode = billCode;
    }

    public boolean isRefunded() {
        return refunded;
    }

    public void setRefunded(boolean refunded) {
        this.refunded = refunded;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SellerIndex)) return false;

        SellerIndex that = (SellerIndex) o;

        if (isLocalDelivery() != that.isLocalDelivery()) return false;
        if (isPreSale() != that.isPreSale()) return false;
        if (isRefunded() != that.isRefunded()) return false;
        if (getId() != null ? !getId().equals(that.getId()) : that.getId() != null) return false;
        if (getMainOrderId() != null ? !getMainOrderId().equals(that.getMainOrderId()) : that.getMainOrderId() != null)
            return false;
        if (getUserId() != null ? !getUserId().equals(that.getUserId()) : that.getUserId() != null) return false;
        if (getSellerId() != null ? !getSellerId().equals(that.getSellerId()) : that.getSellerId() != null)
            return false;
        if (getTradingStatus() != null ? !getTradingStatus().equals(that.getTradingStatus()) : that.getTradingStatus() != null)
            return false;
        if (getAddTime() != null ? !getAddTime().equals(that.getAddTime()) : that.getAddTime() != null) return false;
        if (getPaidTime() != null ? !getPaidTime().equals(that.getPaidTime()) : that.getPaidTime() != null)
            return false;
        if (getAcceptTime() != null ? !getAcceptTime().equals(that.getAcceptTime()) : that.getAcceptTime() != null)
            return false;
        if (getDeliveryTime() != null ? !getDeliveryTime().equals(that.getDeliveryTime()) : that.getDeliveryTime() != null)
            return false;
        if (getRemarkLevel() != null ? !getRemarkLevel().equals(that.getRemarkLevel()) : that.getRemarkLevel() != null)
            return false;
        if (getUserPay() != null ? !getUserPay().equals(that.getUserPay()) : that.getUserPay() != null) return false;
        if (getSales() != null ? !getSales().equals(that.getSales()) : that.getSales() != null) return false;
        if (getYmtCouponAmount() != null ? !getYmtCouponAmount().equals(that.getYmtCouponAmount()) : that.getYmtCouponAmount() != null)
            return false;
        if (getDeliveryType() != null ? !getDeliveryType().equals(that.getDeliveryType()) : that.getDeliveryType() != null)
            return false;
        if (getUserLogin() != null ? !getUserLogin().equals(that.getUserLogin()) : that.getUserLogin() != null)
            return false;
        if (getReceiver() != null ? !getReceiver().equals(that.getReceiver()) : that.getReceiver() != null)
            return false;
        return getBillCode() != null ? getBillCode().equals(that.getBillCode()) : that.getBillCode() == null;

    }

    @Override
    public int hashCode() {
        int result = getId() != null ? getId().hashCode() : 0;
        result = 31 * result + (getMainOrderId() != null ? getMainOrderId().hashCode() : 0);
        result = 31 * result + (getUserId() != null ? getUserId().hashCode() : 0);
        result = 31 * result + (getSellerId() != null ? getSellerId().hashCode() : 0);
        result = 31 * result + (getTradingStatus() != null ? getTradingStatus().hashCode() : 0);
        result = 31 * result + (getAddTime() != null ? getAddTime().hashCode() : 0);
        result = 31 * result + (getPaidTime() != null ? getPaidTime().hashCode() : 0);
        result = 31 * result + (getAcceptTime() != null ? getAcceptTime().hashCode() : 0);
        result = 31 * result + (getDeliveryTime() != null ? getDeliveryTime().hashCode() : 0);
        result = 31 * result + (isLocalDelivery() ? 1 : 0);
        result = 31 * result + (isPreSale() ? 1 : 0);
        result = 31 * result + (getRemarkLevel() != null ? getRemarkLevel().hashCode() : 0);
        result = 31 * result + (getUserPay() != null ? getUserPay().hashCode() : 0);
        result = 31 * result + (getSales() != null ? getSales().hashCode() : 0);
        result = 31 * result + (getYmtCouponAmount() != null ? getYmtCouponAmount().hashCode() : 0);
        result = 31 * result + (getDeliveryType() != null ? getDeliveryType().hashCode() : 0);
        result = 31 * result + (getUserLogin() != null ? getUserLogin().hashCode() : 0);
        result = 31 * result + (getReceiver() != null ? getReceiver().hashCode() : 0);
        result = 31 * result + (getBillCode() != null ? getBillCode().hashCode() : 0);
        result = 31 * result + (isRefunded() ? 1 : 0);
        return result;
    }
}
